package org.springblade.rules.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;

import java.util.List;


@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_rule")
public class Rule extends BaseEntity {

    @Schema(description = "规则主键ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @Schema(description = "规则编码")
    private String code;

    @Schema(description = "规则名称")
    private String name;

    @Schema(description = "规则版本")
    private Integer version;

    //$userProvince == '西藏' || $userProvince == '新疆' || $userProvince == '青海' || $userProvince == '内蒙古' || $userProvince == '甘肃'
    @Schema(description = "规则表达式")
    private String expression;

    //[{"varkey":"$userProvince", "varType":"String","sourceType":"USER_INPUT", "required":true}]
    @Schema(description = "规则特征")
    private String features;

    @Schema(description = "规则类型 EXPRESSION:表达式 METHOD:方法")
    private String type;

    @Schema(description = "规则决策方式 CONTINUE:继续执行 REJECT:直接拒绝")
    private String decisionResult;

    @Schema(description = "拒绝码")
    private String rejectCode;

    @Schema(description = "描述")
    private String description;
}
